var ProgressBar = Laya.ProgressBar,
  RequestMgr = (function () {
    function e() {}
    return (
      (e.prototype.showLogger = function (e) {
        (this.logger = new Laya.Text()),
          (this.logger.fontSize = 30),
          (this.logger.color = "#FFFFFF"),
          (this.logger.align = "center"),
          (this.logger.valign = "middle"),
          this.logger.size(300, Laya.stage.height),
          (this.logger.text = e),
          Laya.stage.addChild(this.logger);
      }),
      (e.prototype.requestRegister = function (e) {
        (this.xhr = new Laya.HttpRequest()),
          this.xhr.once(
            Laya.Event.PROGRESS,
            this,
            this.onHttpRegisterRequestProgress
          ),
          this.xhr.once(
            Laya.Event.COMPLETE,
            this,
            this.onHttpRegisterRequestComplete
          ),
          this.xhr.once(
            Laya.Event.ERROR,
            this,
            this.onHttpRegisterRequestError
          );
        var t = Md5.hashStr("123456");
        console.log("e10adc3949ba59abbe56e057f20f883e" == t),
          this.xhr.send(
            "https://d.iiqingqu.com/user-service/user/register",
            JSON.stringify({
              captcha: "1234",
              mobile: "13664323326",
              channel: "string",
              pwd: "e10adc3949ba59abbe56e057f20f883e",
            }),
            "post",
            "json",
            ["Content-Type", "application/json"]
          );
      }),
      (e.prototype.onHttpRegisterRequestProgress = function (e) {
        console.log("onHttpRegisterRequestProgress" + e);
      }),
      (e.prototype.onHttpRegisterRequestComplete = function (e) {
        RegDialog.closeAll();
        var t = this.xhr.data;
        console.log(t),
          (t.msg = "验证码错误") &&
            (this.logger.text = "验证码错误,请确认重新输入");
      }),
      (e.prototype.onHttpRegisterRequestError = function (e) {
        console.log("onHttpRegisterRequestComplete" + e),
          (this.logger.text = "登陆失败");
      }),
      (e.prototype.requestLogin = function (e) {
        (this.xhr = new Laya.HttpRequest()),
          this.xhr.once(Laya.Event.PROGRESS, this, this.onHttpRequestProgress),
          this.xhr.once(Laya.Event.COMPLETE, this, this.onHttpRequestComplete),
          this.xhr.once(Laya.Event.ERROR, this, this.onHttpRequestError);
        var t = Md5.hashStr("123456");
        console.log(t),
          console.log("e10adc3949ba59abbe56e057f20f883e" == t),
          this.xhr.send(
            "https://d.iiqingqu.com/user-service/user/login",
            JSON.stringify({
              captcha: "1234",
              mobile: "13664323326",
              channel: "string",
              pwd: "e10adc3949ba59abbe56e057f20f883e",
            }),
            "post",
            "json",
            ["Content-Type", "application/json"]
          );
      }),
      (e.prototype.onHttpRequestProgress = function (e) {
        console.log("processHandler" + e);
      }),
      (e.prototype.onHttpRequestError = function (e) {
        console.log("errorHandler" + e), (this.logger.text = "登陆失败");
      }),
      (e.prototype.onHttpRequestComplete = function (e) {
        RegDialog.closeAll();
        var t = this.xhr.data;
        (t.msg = "用户不存在")
          ? console.log("用户真的不存在")
          : console.log("用户存在"),
          (this.logger.text += "收到数据\n" + t.msg + "\n 临时跳转"),
          Laya.timer.once(1e3, this, this.dealay);
      }),
      (e.prototype.dealay = function () {
        this.logger.removeSelf();
        var e = ServerListView.openServerListView();
        Laya.stage.addChild(e);
      }),
      (e.prototype.onLoadComplete = function () {
        (this.progressBar = new ProgressBar("/res/ui/progressBar.png")),
          (this.progressBar.width = 400),
          (this.progressBar.x =
            (Laya.stage.width - this.progressBar.width) / 2),
          (this.progressBar.y = Laya.stage.height / 2),
          (this.progressBar.sizeGrid = "5,5,5,5"),
          (this.progressBar.changeHandler = new Handler(this, this.onChange)),
          Laya.stage.addChild(this.progressBar);
      }),
      (e.prototype.changeValue = function () {
        this.progressBar.value >= 1 && (this.progressBar.value = 0),
          (this.progressBar.value += 0.05);
      }),
      (e.prototype.onChange = function (e) {
        console.log("进度：" + Math.floor(100 * e) + "%");
      }),
      e
    );
  })();
